package com.example.demo.controller;

import com.example.demo.entity.preinspectionmanage;
import com.example.demo.service.PreinspectionmanageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("pre")
@CrossOrigin//允许跨域
@Api(tags= "预防性检修相关操作类",value = "预防性检修相关操作类")
public class Preinspectionmanage {
    @Resource
    PreinspectionmanageService PreinspectionmanageService;

    @PostMapping("/insert")
    @ApiOperation(value = "插入",notes = "成功返回‘插入成功’，失败返回‘插入失败’")
    public String insert(@RequestBody preinspectionmanage preinspectionmanage)
    {
        return PreinspectionmanageService.insert(preinspectionmanage);
    }

    @PostMapping("/query")
    @ApiOperation(value = "查询",notes = "返回所有预防性检修信息")
    public List query()
    {
        return PreinspectionmanageService.query();
    }

    @PostMapping("/update")
    @ApiOperation(value = "更新",notes = "更新所有预防性检修信息，key作为标识不可修改")
    public String update(@RequestBody preinspectionmanage preinspectionmanage)
    {
        return PreinspectionmanageService.update(preinspectionmanage);
    }
}
